package leetcode.code1441;

import java.util.ArrayList;
import java.util.List;

public class Solution {

	private static String Push = "Push";
	private static String Pop = "Pop";

	public List<String> buildArray(int[] target, int n) {
		List<String> ans = new ArrayList<>();
		for (int i = 1, j = 0; i <= n && j < target.length; i++) {
			if (i == target[j]) {
				j++;
				ans.add(Push);
			} else {
				ans.add(Push);
				ans.add(Pop);
			}
		}
		return ans;
	}
}
